package com.xinxin.leetcode.problem389;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
 * @author ShiXinXin
 * @date 2019-12-15 3:44
 */
public class Solution {
    public char findTheDifference(String s, String t) {
        int[] arr = new int[26];
        for (char c : s.toCharArray()) {
            ++arr[c - 97];
        }
        for (char c : t.toCharArray()) {
            --arr[c - 97];
        }
        for (int i = 0; i < 26; i++) {
            if (arr[i] < 0) {
                return (char) (i + 97);
            }
        }
        return (char) 0;
    }

    public static void main(String[] args) {
        System.out.println(new Solution().findTheDifference("abcd", "abcde"));
    }
}
